/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package network.packets;

import utils.StringUtils;
import utils.Utils;

/**
 *
 * @author kvest
 */
public class DriversQueueResponce extends Packet
{
    private String driversQueue;
    
    public DriversQueueResponce(byte[] data)
    {
        super(DRIVERS_QUEUE_RESPONCE, data);
    }

    protected void parse(byte[] data)
    {
        int offset = 2;

        //Список позывных
        byte[] buffer = new byte[4];
        System.arraycopy(data, offset, buffer, 0, buffer.length);
        offset += buffer.length;
        int stringSize = Utils.byteToInt(buffer);
        buffer = new byte[stringSize];
        System.arraycopy(data, offset, buffer, 0, buffer.length);
        offset += buffer.length;
        driversQueue = StringUtils.bytesToStr(buffer);
    }

    public void print()
    {
        System.out.println("DriversQueueResponce=" + driversQueue);
    }

    public String getDriversQueue()
    {
        return driversQueue;
    }
}
